/*
 * Copyright 2008 Nathan C Jones
 * 
 * This file is part of Fivehundred.
 * 
 * Fivehundred is free software: you can redistribute it and/or modify it under
 * the terms of the GNU General Public License as published by the Free Software
 * Foundation, either version 3 of the License, or (at your option) any later
 * version.
 * 
 * Fivehundred is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
 * details.
 * 
 * You should have received a copy of the GNU General Public License along with
 * Fivehundred. If not, see <http://www.gnu.org/licenses/>. 
 */
package com.googlecode.fivehundred.game;

import com.googlecode.fivehundred.model.Suit;

/**
 * Enumeration of all the possible bids.
 * 
 * @author Nathan C Jones
 */
public enum Bid {

	SixSpades(Suit.Spades, 6),
	SixClubs(Suit.Clubs, 6),
	SixDiamonds(Suit.Diamonds, 6),
	SixHearts(Suit.Hearts, 6),
	SixNoTrumps(null, 6),
	SevenSpades(Suit.Spades, 7),
	SevenClubs(Suit.Clubs, 7),
	SevenDiamonds(Suit.Diamonds, 7),
	SevenHearts(Suit.Hearts, 7),
	SevenNoTrumps(null, 7),
	Misere(null, 0),
	EightSpades(Suit.Spades, 8),
	EightClubs(Suit.Clubs, 8),
	EightDiamonds(Suit.Diamonds, 8),
	EightHearts(Suit.Hearts, 8),
	EightNoTrumps(null, 8),
	NineSpades(Suit.Spades, 9),
	NineClubs(Suit.Clubs, 9),
	NineDiamonds(Suit.Diamonds, 9),
	NineHearts(Suit.Hearts, 9),
	NineNoTrumps(null, 9),
	TenSpades(Suit.Spades, 10),
	TenClubs(Suit.Clubs, 10),
	TenDiamonds(Suit.Diamonds, 10),
	TenHearts(Suit.Hearts, 10),
	OpenMisere(null, 0),
	TenNoTrumps(null, 10);

	private Suit trumpSuit;

	private int trickCount;

	private Bid(final Suit suit, final int trickCount) {
		this.trumpSuit = suit;
		this.trickCount = trickCount;
	}

	/**
	 * Get the suit associated with the bid.
	 * 
	 * @return the bid's suit, or <code>null</code> if it is a no-trumps style
	 *         bid.
	 */
	public Suit getTrumpSuit() {
		return trumpSuit;
	}
	
	/**
	 * @return the number of tricks required to win the bid.
	 */
	public int getTrickCount() {
		return trickCount;
	}

	/**
	 * Determine if the bid is a no-trumps style.
	 * 
	 * @return <code>true</code> if the bid is a no-trumps or misere bid.
	 */
	public boolean isNoTrumps() {
		return trumpSuit == null;
	}
}
